/*
package servlets;

import entity.DBParam;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.Connection;
import java.sql.DriverManager;

@Controller("/dbParameters")
public class TestDBConnectionController extends SimpleFormController {

    public TestDBConnectionController() {
        setFormView("dbParameters");
        setCommandClass(DBParam.class);
        setSuccessView("success");
        setCommandName("dbParam");
    }

    @Override
    protected ModelAndView processFormSubmission(HttpServletRequest request,
            HttpServletResponse response, Object command, BindException errors)
            throws Exception {
        System.out.println("form submitted");

        DBParam dbParam = (DBParam)command;
        String url = dbParam.getUrl();
        String username = dbParam.getUsername();
        String password = dbParam.getPassword();

        // make a connection
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection conn = DriverManager.getConnection(url, username, password);
        System.out.println("got a connection: " + conn);

        return super.processFormSubmission(request, response, command, errors);
    }
}

*/
